package com.app.couponsharelife.ui.main.login

import android.content.Intent
import com.app.couponsharelife.R
import com.app.couponsharelife.base.BaseActivity
import com.app.couponsharelife.utils.AppUtils
import kotlinx.android.synthetic.main.activity_useridentity.*

/**
 *Created by xct on 2019/1/3
 *Description:用户身份选择页面
 */
class UserIdentitySelect:BaseActivity() {
    private var userId=""
    private var userName=""
    private var unionId=""
    private var headPrice=""
    private var sex=""
    private var city=""
    private var province=""
    override val viewLayoutId: Int
        get() = R.layout.activity_useridentity

    override fun initViews() {
        AppUtils.initImmersionBar(this,true)
        userId=intent.getStringExtra("UserId")?:""
        userName=intent.getStringExtra("UserName")?:""
        unionId=intent.getStringExtra("UnionId")?:""
        headPrice=intent.getStringExtra("HeadPrice")?:""
        sex=intent.getStringExtra("Sex")
        city=intent.getStringExtra("City")
        province=intent.getStringExtra("Province")
        useridentity_llcolse.setOnClickListener {
            finish()
        }
        useridentity_llnew.setOnClickListener {
            if (userId.isNotEmpty()) {
                val intent = Intent(this, InviteCodeActivity::class.java)
                intent.putExtra("UserId", userId)
                intent.putExtra("UserName", userName)
                intent.putExtra("UnionId", unionId)
                intent.putExtra("HeadPrice", headPrice)
                intent.putExtra("Sex", sex)
                intent.putExtra("City", city)
                intent.putExtra("Province", province)
                startActivity(intent)
            }else{
                showToastMsg("数据出错，请退出重试！")
            }
        }
        useridentity_llold.setOnClickListener {
            if (userId.isNotEmpty()) {
                val intent = Intent(this, BindingPhoneActivity::class.java)
                intent.putExtra("UserId", userId)
                intent.putExtra("UserName", userName)
                intent.putExtra("UnionId", unionId)
                intent.putExtra("HeadPrice", headPrice)
                intent.putExtra("Sex", sex)
                intent.putExtra("City", city)
                intent.putExtra("Province", province)
                startActivity(intent)
            }else{
                showToastMsg("数据出错，请退出重试！")
            }
        }
    }

    override fun onDestroy() {
        super.onDestroy()
        AppUtils.destroyImmersionBar(this)
    }
}